# 读取整个文件
filename = 'pi_digits.txt'

# 创建一个包含文件各行内容的列表
with open(filename) as file_object:
    lines = file_object.readlines()

for line in lines:
    print(line.rstrip())

# 逐行读取
with open(filename) as file_object:
    for line in file_object:
        print(line)



'''
3.1415926535
  8979323846
  2643383279
3.1415926535

  8979323846

  2643383279

'''